import { $get } from "@src/assets/js/request"
import { decompressLicenseAndMobile } from "@src/assets/js/tool"

// 获取匹配数据
export async function getPersonListRequest (name) {
  const res = await $get('/api/xd/party/getByName', {
    name,
    subject_type: '企业'
  })
  if (res.data instanceof Array) {
    res.data.forEach(li => {
      decompressLicenseAndMobile(li)
    })
  }
  return res.data
}

// 通过完整姓名获取数据
export async function getPersonDataRequest (name) {
  const res = await $get('/api/xd/party/getByFullName', {
    name,
    subject_type: '企业'
  })
  if (res.data instanceof Array) {
    res.data.forEach(li => {
      decompressLicenseAndMobile(li)
    })
  }
  return res.data[0]
}